package org.hhw.client;

import feign.Response;
import org.hhw.util.AjaxResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

@FeignClient(value = "HRM-COMMON",configuration = FeignMultipartSupportConfig.class,fallbackFactory = FastDfsClientFallbackFactory.class)
@RequestMapping("/fastdfs")
public interface FastDfsClient {
    //文件上传
    @PostMapping(produces = {MediaType.APPLICATION_JSON_UTF8_VALUE},consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
    AjaxResult upload(@RequestPart(required = true, value = "file") MultipartFile file);

    //文件下载 feign的Response来接收数据
    @GetMapping
    Response download(@RequestParam(required = true, value = "path") String path);
}
